import services, { servicesSmp } from '../createServices';

// common
export const common = {
  getCodeConfig: (params) => servicesSmp.post('/sys-dict/get-code-config', { params }),
  upload: (params, isLoading) => services.upload('/file/chunk-upload', { params, isLoading: true }),
  uploadImg: (params, isLoading) => services.upload('/file/upload', { params, isLoading: true }),
};

// 部门管理
export const dept = {
  add: (params) => services.post('/dept/create', { params, isLoading: true }),
  update: (params) => services.post('/dept/edit', { params, isLoading: true }),
  delete: (params) => services.post('/dept/delete', { params, isLoading: true }),
  list: (params) => services.post('/dept/list', { params, isLoading: true }),
  all: (params) => services.post('/dept/all', { params, isLoading: true }),
  set: (params) => services.post('/user-dept/set-user-current-dept', { params, isLoading: true }),
  currentList: (params) => services.post('/user-dept/current-user-dept-list', { params }),
  hasRight: (params) => services.post('/dept/has-right', { params }),
  tree: (params) => services.post('/dept/tree', { params, isLoading: true }),
  detail: (params) => services.post('/dept/detail', { params, isLoading: true }),
  getDeptByAppProduct: (params) => services.post('/dept/get-dept-by-app-product', { params, isLoading: true }), //根据渠道/产品查询事件的可见部门
};

// 数据类型列表
export const dataType = {
  list: (params) => servicesSmp.post('/data-type/list', { params, isLoading: true }),
};
